package lab.domain;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public abstract class NamedRecord<T extends NamedRecord> extends Record<T> implements Serializable {
    @XmlAttribute
    protected String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        notifyChanged();
    }

    @Override
    public NamedRecord clone() {
       NamedRecord record = (NamedRecord) super.clone();
       record.name = name;
       return record; 
    }
    
    public void copy(T object) {
        super.copy(object);
        this.name = object.name;
    }

    @Override
    public String toString() {
        return name;
    }
}
